package cn.it.hbtt.petoa.entity;

import java.security.interfaces.RSAKey;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *  宠物主人类
 * @author John
 * @create 2020-06-04 11:22
 */
public class PetOwner implements RowMapper{

    private  Integer id; //主人的id
    private  String name; //主人的账号
    private  String password;//主人的密码
    private  int money;//主人的元宝数

    public PetOwner() {
    }

    public PetOwner(Integer id,
                    String name, String password, int money) {
        this.id = id;
        this.name = name;
        this.password = password;
        this.money = money;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    public PetOwner getRow(ResultSet rs) {
        PetOwner petOwner = null;
        try {
            int id = rs.getInt("id");
            String name = rs.getString("name");
            String password = rs.getString("password");
            int money = rs.getInt("money");
            petOwner = new PetOwner(id,name,password, this.money);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return petOwner;
    }
}
